# -*- coding: utf-8 -*-

from hlm.channel import *
from hlm.channel import ChannelProperty as cp

from ip.opdef import ExecOp, TranOp


class ChannelStoreFabric(Channel):
    lanes_map = {
        'Bus': {
            cp.PORTS: [('data', -1, complex), ('addr', -1, int)],
            cp.GET: ['addr', 'data']
        }
    }


class ChannelLoadFabric(Channel):
    lanes_map = {
        'Bus': {
            cp.PORTS: [('data', -1, complex), ('addr', -1, int), ('pid', -1, int),
                       ('sb_addr', -1, int), ('ain_addr', -1, int), ('clr', -1, bool)],
            cp.GET: ['pid', 'addr', 'data', 'sb_addr', 'ain_addr', 'clr']
        }
    }


class ChannelLoadReqFabric(Channel):
    lanes_map = {
        'Bus': {
            cp.PORTS: [('mem_addr', -1, int), ('pid', -1, int), ('sm_addr', -1, int),
                       ('sb_addr', -1, int), ('ain_addr', -1, int), ('clr', -1, bool)],
            cp.GET: ['mem_addr', 'pid', 'sm_addr', 'sb_addr', 'ain_addr', 'clr']
        }
    }


class ChannelExecOpFabric(Channel):
    lanes_map = {
        'Bus': {cp.PORTS: [('nano_op', -1, ExecOp)],
                cp.GET: ['nano_op']}
    }


class ChannelTranOpFabric(Channel):
    lanes_map = {
        'Bus': {cp.PORTS: [('nano_op', -1, TranOp)],
                cp.GET: ['nano_op']}
    }
